/**
 * iSocial Project
 * http://isocial.missouri.edu
 *
 * Copyright (c) 2011, University of Missouri iSocial Project, All Rights Reserved
 *
 * Redistributions in source code form must reproduce the above
 * copyright and this condition.
 *
 * The contents of this file are subject to the GNU General Public
 * License, Version 2 (the "License"); you may not use this file
 * except in compliance with the License. A copy of the License is
 * available at http://www.opensource.org/licenses/gpl-license.php.
 *
 * The iSocial project designates this particular file as
 * subject to the "Classpath" exception as provided by the iSocial
 * project in the License file that accompanied this code.
 */
package org.jdesktop.wonderland.modules.isocial.generic.client;

/**
 * The panel to show open ended questions.
 *
 * @author Kaustubh
 */
public class OEQPanel extends javax.swing.JPanel {

    /** Creates new form OEQPanel */
    public OEQPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        questionField = new javax.swing.JScrollPane();
        questionArea = new javax.swing.JTextArea();
        answerField = new javax.swing.JScrollPane();
        answerArea = new javax.swing.JTextArea();

        setPreferredSize(new java.awt.Dimension(350, 210));

        questionArea.setBackground(new java.awt.Color(238, 238, 238));
        questionArea.setColumns(20);
        questionArea.setEditable(false);
        questionArea.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        questionArea.setLineWrap(true);
        questionArea.setRows(3);
        questionArea.setWrapStyleWord(true);
        questionField.setViewportView(questionArea);

        answerArea.setColumns(20);
        answerArea.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
        answerArea.setLineWrap(true);
        answerArea.setRows(3);
        answerArea.setWrapStyleWord(true);
        answerField.setViewportView(answerArea);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(questionField, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
            .addComponent(answerField, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(questionField, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(answerField, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea answerArea;
    private javax.swing.JScrollPane answerField;
    private javax.swing.JTextArea questionArea;
    private javax.swing.JScrollPane questionField;
    // End of variables declaration//GEN-END:variables

    void setQuestion(String value) {
        this.questionArea.setText((value == null) ? "Question" : value);
    }

    String getSelectedAnswers() {
        if (answerArea.getText() != null) {
            return answerArea.getText();
        }
        return "";
    }
}
